package com.by.example.consumer;

import com.by.example.common.model.User;
import com.by.example.common.service.UserService;
import com.by.rpc.bootstrap.ConsumerBootstrap;
import com.by.rpc.proxy.ServiceProxyFactory;

/**
 * @author lzh
 */
public class ConsumerExample {

    public static void main(String[] args) {
        // 初始化
        ConsumerBootstrap.init();

        // 获取代理
        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("baiyu");

        // 调用
        User newUser = userService.getUser(user);
        if (newUser != null) {
            System.out.println("用户名：" + newUser.getName());
        } else {
            System.out.println("user == null");
        }
        System.out.println("数字：" + userService.getNumber());
    }
}
